#include <buola/xml/cnode.h>
#include <buola/io.h>

#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"

using namespace buola;

int main()
{
    io::PStream lStream=io::open(io::get_home()/"pr2.urdf",io::EMode::READ);
    char lBuffer[200000];
    size_t lLength=lStream->Read((uint8_t*)lBuffer,200000).Count();
    lBuffer[lLength]=0;
    msg_info() << "length: " << lLength << "\n";
    std::string lText(lBuffer,lLength);
    
    int lSum=0;
    start_timer();
    for(int i=0;i<1000;i++)
    {
        xml::CDoc lDoc;
        lDoc.Parse(lBuffer,lLength);
        lSum+=lDoc.Root().Name().length();
    }
    end_timer();
    msg_info() << lSum << "\n";

    
}